#pragma once
#ifndef __G_TYPES_H__
#define __G_TYPES_H__

#include <stddef.h> 
#include <float.h>

#define		G_DELETE(Pointer)		{if (Pointer != NULL) {delete Pointer; Pointer = NULL;}}
#define		G_DELETE_ARR(Pointer)	{if (Pointer != NULL) {delete [] Pointer; Pointer = NULL;}}


#define		CACHELINE_SIZE			64
#define		CACHELINE_ALIGNED		__declspec(align(CACHELINE_SIZE))

#define		OVERRIDE		// To state that function is overriden.
#define		PLATFORM		// To state that function is platform specific.
#define		OPTIONAL		// To state that function parameter is optional.
#define		OUTPUT			// To state that function parameter is output.
#define		INOUT			// To state that function parameter is both input and output

// Multiples of pi
#define		G_PI_TIME_10			31,41592654f
#define		G_PI_TIME_8				25.13274129f
#define		G_PI_TIME_6				18.84955592f
#define		G_PI_TIME_4				12.56637061f
#define		G_PI_TIME_3				9,424777961f
#define		G_PI_TIME_2				6.283185307f
#define		G_PI					3.141592654f
#define		G_PI_OVER_2				1.570796328f
#define		G_PI_OVER_3				1,047197551f
#define		G_PI_OVER_4				0.785398164f
#define		G_PI_OVER_6				0.523598776f
#define		G_PI_OVER_8				0.392699082f
#define		G_PI_OVER_10			0.314159265f

// Useful floating point defines
#define		G_FLOAT_MIN				FLT_MIN
#define		G_FLOAT_MAX				FLT_MAX

#define		G_ZERO_TRESHOLD			0.00001f

// Max lenght of file path
#define		G_MAX_PATH_LENGHT		256

// Type definitions
typedef		char					GInt8;
typedef		unsigned char			GUInt8;

typedef		short					GInt16;
typedef		unsigned short			GUInt16;

typedef		long int				GInt32;
typedef		unsigned long int		GUInt32;

typedef		long long int			GInt64;
typedef		unsigned long long int	GUInt64;

typedef		size_t					GSize;
typedef		ptrdiff_t				GSSize;


#if defined (G_COMPILER_MSVC)
	#ifdef G_DYNAMIC_MODULE // When developing module(dll project)
		// Module methods will be exported for engine
		#define G_MODULE_API	__declspec(dllexport)
		// Engine methods will be imported by modules 		
		#define G_ENGINE_API	__declspec(dllimport)
	#else
		// When Developing engine
		// Module methods will be imported by engine 
		#define G_MODULE_API	__declspec(dllimport)
		// Engine methods will be exported for modules
		#define G_ENGINE_API	__declspec(dllexport)
	#endif
#elif defined (__APPLE__)
	//! No idea
#elif defined (__MINGW32__)
	//! No idea
#elif defined (__GNUC__) && defined (__unix__)
	#ifdef G_DYNAMIC_MODULE
		#define	G_MODULE_API	__attribute__ ((__visibility__("default")))
		#define G_ENGINE_API	//! should be empty ?
	#else
		#define	G_MODULE_API	//! should be empty ?
		#define G_ENGINE_API	__attribute__ ((__visibility__("default")))
	#endif
#elif defined (__GNUC__) && defined (_WIN32)
	#ifdef G_DYNAMIC_MODULE
		#define	G_MODULE_API	__attribute__ ((dllexport))
		#define G_ENGINE_API	__attribute__ ((dllimport))
	#else
		#define	G_MODULE_API	__attribute__ ((dllimport))
		#define G_ENGINE_API	__attribute__ ((dllexport))
	#endif
#else
		#define G_MODULE_API
		#define G_ENGINE_API
#endif

#endif /* __G_TYPES_H__ */